<%--
  User: ljc,Date: 2025/11/5,Time: 11:43  
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>上传图片</title>
</head>
<body>
<form action="<%=request.getContextPath()%>/upload" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<%=request.getParameter("id")%>">
    图片 <input type="file" name="photo" accept="image/*" onchange="previewImg(this)">(multiple)
    <input type="submit">
</form>
<div>
    <img src="" id="disp" alt="" style="max-width: 200px">
</div>
<script>
    const previewImg=fileInput=>{
        const file=fileInput.files[0];
        const container=document.querySelector("#disp");
        container.src=URL.createObjectURL(file);
    }
</script>
</body>
</html>
